<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<%@ page import="com.model.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../css/css.css" rel="stylesheet" type="text/css" />
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<title>物品出入总表</title>
</head>
<%
	Connection con = DataBase.getConnection();
	PreparedStatement pstmt = con.prepareStatement("select * from item_history as ih left join (select iid,name,brand,unit from item) as i on ih.iid=i.iid ORDER BY ihid DESC");
	ResultSet rs = pstmt.executeQuery();
%>
<body class="ContentBody">
  <table style="width:100%; height:100%;" border="1px" cellspacing="0px" cellpadding="4px">
    <tr align="center"><td colspan="9" style="font-size:16px; font-weight:900;" class="tablestyle_title">物品出入总表</td></tr>
    <tr style="height:20px; " class="zsd" align="center">
      <td style="width:19%">时间</td>
      <td style="width:15%">物品名称</td>
      <td style="width:11%">物品品牌</td>
      <td style="width:11%">数量</td>
      <td style="width:11%">从</td>
      <td style="width:11%">到</td>
      <td style="width:11%">经手人</td>
      <td style="width:11%">进出情况</td>
    </tr>
    <%
    	while( rs.next() ){%>
    		<tr>
    			<td><%=rs.getString("time") %></td>
    			<td><%=rs.getString("name") %></td>
    			<td><%=rs.getString("brand") %></td>
    			<td><%=(rs.getDouble("number")>0?rs.getString("number"):rs.getString("number").substring(1))+"("+rs.getString("unit")+")" %></td>
    			<td><%=rs.getString("from")==null?"":rs.getString("from") %></td>
    			<td><%=rs.getString("to")==null?"":rs.getString("to") %></td>
    			<td><%=rs.getString("person") %></td>
    			<td><%=rs.getDouble("number")>0?"入库":(   ((rs.getString("from")!=null)&&(rs.getString("to")!=null))?"转移":"出库"  ) %></td>
    		</tr>
	<%} %>
  </table>
</body>
<%
	rs.close();
	con.close();
%>
</html>